
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<jsp:include page = "../../metadatos.jsp" flush = "True" />
<html>
    <head>
        <title>Caja</title>
        <script>
            function enCeros() {
                alert("TIENE QUE INGRESAR AL MENOS UN CONCEPTO DE COMPRA PARA PODER ENVIAR LA ORDEN ");
            }
        </script>
    </head>
    <body>
        <div class="wrapper">
            <header class="header">
                <img src="./resources/Logo - copia_1.PNG" />
            </header>
            <jsp:include page = "../../menuNavegacion.jsp" flush = "True" />
            <main class="content">
                <form method="post" class="formee" action="./PuntoVenta?action=entraArticuloVenta">
                    <fieldset >
                        <legend>ENTRE ARTICULO</legend>

                        <c:if test="${principalTPV.nErrores>0}">
                            <div class="formee-msg-error">
                                <h3>Incidencias:</h3>
                                <ul>
                                    <c:forEach items="${principalTPV.errores}" var="e">
                                        <li><c:out value="${e}"/></li>
                                        </c:forEach>
                                </ul>
                            </div>
                        </c:if>
                        
                        <div class="grid-2-12">
                            <input type="button" value="Finalizar Venta" onclick="popup('./PuntoVenta?action=finVenta', 400, 400);"/>
                        </div>
                        
                        <div class="grid-2-12">
                            <input type="button" value="Reiniciar Venta" onclick="location.href = './PuntoVenta?action=reiniciaVenta'"/>
                        </div>
                        
                        <div class="grid-2-12">
                            <input type="button" value="Producto Granel" onclick="location.href = './PuntoVenta?action=buscarProductoGranel&index=1'"/>
                        </div>

                        <div class="grid-12-12">    
                            <label>CODIGO DE BARRAS<em class="formee-req">*</em></label>
                            <input type="text" name="codigoBarrasArticulo"  autofocus="yes"  onchange="enter()" onKeyup="this.value = txtalfanum(this.value)" value="" />
                        </div>

                        <div class="grid-12-12">
                            <table class="bordered" width="100%">
                                <thead>
                                    <tr>
                                        <th colspan="4"><div align="right"><strong>TOTAL DE LA COMPRA</strong></div></th>
                                        <th><div align="center"><strong>$<c:out value="${principalTPV.totalVenta}"/></strong></div></th>
                                    </tr>
                                    <tr>
                                        <th>CB</th>
                                        <th>Descripcion</th>
                                        <th>Cantidad</th>
                                        <th>Subtotal</th>
                                        <th>Eliminar Artciulo</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <c:forEach items="${principalTPV.articulosCompra}" var="itm">
                                        <tr>
                                            <td> <c:out value="${itm.cb}"/> </td>
                                            <td> <c:out value="${itm.descripcion}"/> </td>
                                            <td> <c:out value="${itm.cantidad}"/> </td>
                                            <td> <c:out value="${itm.subTotal}"/> </td>
                                            <td> 
                                                <div align="center">
                                                    <img src="./resources/delete-icon.png" 
                                                         width="30" height="30" onclick="location.href = './PuntoVenta?action=cancelaArticulo&id=<c:out value="${itm.id}"/>'"/>
                                                </div> 
                                            </td>
                                        </tr>
                                    </c:forEach>
                                </tbody>
                                <thead>
                                    <tr>
                                        <th colspan="4"><div align="right"><strong>TOTAL DE LA COMPRA</strong></div></th>
                                        <th><div align="center"><strong>$<c:out value="${principalTPV.totalVenta}"/></strong></div></th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                    </fieldset>
                </form>
            </main>
    </body>
</html>
<jsp:include page = "../../pie.jsp" flush = "True" />

